

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>2. VideoTester.core — Client and server base classes &mdash; VideoTester 0.2 documentation</title>
    
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="shortcut icon" href="_static/VTfavicon.png"/>
    <link rel="top" title="VideoTester 0.2 documentation" href="index.html" />
    <link rel="up" title="Module Reference" href="modules.html" />
    <link rel="next" title="3. VideoTester.gstreamer — Video processing with GStreamer bindings" href="gstreamer.html" />
    <link rel="prev" title="1. VideoTester.config — Common constants and functions" href="config.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="gstreamer.html" title="3. VideoTester.gstreamer — Video processing with GStreamer bindings"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="config.html" title="1. VideoTester.config — Common constants and functions"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">VideoTester 0.2 documentation</a> &raquo;</li>
          <li><a href="modules.html" accesskey="U">Module Reference</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-VideoTester.core">
<span id="videotester-core-client-and-server-base-classes"></span><h1>2. <tt class="docutils literal"><span class="pre">VideoTester.core</span></tt> &#8212; Client and server base classes<a class="headerlink" href="#module-VideoTester.core" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="VideoTester.core.Client">
<em class="property">class </em><tt class="descclassname">VideoTester.core.</tt><tt class="descname">Client</tt><big>(</big><em>file</em>, <em>gui=False</em><big>)</big><a class="headerlink" href="#VideoTester.core.Client" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#VideoTester.core.VT" title="VideoTester.core.VT"><tt class="xref py py-class docutils literal"><span class="pre">VideoTester.core.VT</span></tt></a></p>
<p>VT Client class.</p>
<dl class="attribute">
<dt id="VideoTester.core.Client.conf">
<tt class="descname">conf</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.Client.conf" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary of configuration options.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.core.Client.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#VideoTester.core.Client.run" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Run the client and perform all the operations:</dt>
<dd><ul class="first last simple">
<li>Connect to the server.</li>
<li>Receive video while sniffing packets.</li>
<li>Close connection.</li>
<li>Process data and extract information.</li>
<li>Run meters.</li>
</ul>
</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A list of measures (see <a class="reference internal" href="m-core.html#VideoTester.measures.core.Meter.measures" title="VideoTester.measures.core.Meter.measures"><tt class="xref py py-attr docutils literal"><span class="pre">VideoTester.measures.core.Meter.measures</span></tt></a>) and the path to the temporary directory plus files prefix: <tt class="docutils literal"><span class="pre">&lt;path-to-tempdir&gt;/&lt;prefix&gt;</span></tt>.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">tuple</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.core.Client.video">
<tt class="descname">video</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.Client.video" title="Permalink to this definition">¶</a></dt>
<dd><p>Path to the selected video.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="VideoTester.core.Server">
<em class="property">class </em><tt class="descclassname">VideoTester.core.</tt><tt class="descname">Server</tt><a class="headerlink" href="#VideoTester.core.Server" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#VideoTester.core.VT" title="VideoTester.core.VT"><tt class="xref py py-class docutils literal"><span class="pre">VideoTester.core.VT</span></tt></a>, <a class="reference external" href="http://docs.python.org/library/simplexmlrpcserver.html#SimpleXMLRPCServer.SimpleXMLRPCServer" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">SimpleXMLRPCServer.SimpleXMLRPCServer</span></tt></a></p>
<p>VT Server class.</p>
<dl class="attribute">
<dt id="VideoTester.core.Server.exports">
<tt class="descname">exports</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.Server.exports" title="Permalink to this definition">¶</a></dt>
<dd><p>List of exported methods (<a class="reference internal" href="#VideoTester.core.Server.run" title="VideoTester.core.Server.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> and <a class="reference internal" href="#VideoTester.core.Server.stop" title="VideoTester.core.Server.stop"><tt class="xref py py-meth docutils literal"><span class="pre">stop()</span></tt></a>).</p>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.core.Server.port">
<tt class="descname">port</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.Server.port" title="Permalink to this definition">¶</a></dt>
<dd><p>Next RTSP port (integer). It increases each time by one.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.core.Server.run">
<tt class="descname">run</tt><big>(</big><em>bitrate</em>, <em>framerate</em><big>)</big><a class="headerlink" href="#VideoTester.core.Server.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Run a subprocess for an RTSP server with a given bitrate and framerate (if not running)
or add a client (if running).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>bitrate</strong> (<em>string or integer</em>) &#8211; The bitrate (in kbps).</li>
<li><strong>framerate</strong> (<em>string or integer</em>) &#8211; The framerate (in fps).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The RTSP server port.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">integer</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises OSError:</th><td class="field-body"><p class="first last">An error ocurred while running subprocess.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.core.Server.servers">
<tt class="descname">servers</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.Server.servers" title="Permalink to this definition">¶</a></dt>
<dd><p>Dictionary of running RTSP servers.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.core.Server.stop">
<tt class="descname">stop</tt><big>(</big><em>bitrate</em>, <em>framerate</em><big>)</big><a class="headerlink" href="#VideoTester.core.Server.stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Stop an RTSP server with a given bitrate and framerate (if no remaining clients)
or remove a client (if remaining clients).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>bitrate</strong> (<em>string or integer</em>) &#8211; The bitrate (in kbps).</li>
<li><strong>framerate</strong> (<em>string or integer</em>) &#8211; The framerate (in fps).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">True.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">boolean</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.core.Server.videos">
<tt class="descname">videos</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.Server.videos" title="Permalink to this definition">¶</a></dt>
<dd><p>List of available videos.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="VideoTester.core.VT">
<em class="property">class </em><tt class="descclassname">VideoTester.core.</tt><tt class="descname">VT</tt><a class="headerlink" href="#VideoTester.core.VT" title="Permalink to this definition">¶</a></dt>
<dd><p>Superclass that gathers several common functionalities shared by the client and the server.</p>
<dl class="method">
<dt id="VideoTester.core.VT.parseConf">
<tt class="descname">parseConf</tt><big>(</big><em>file</em>, <em>section</em><big>)</big><a class="headerlink" href="#VideoTester.core.VT.parseConf" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract a section from a configuration file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>file</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#string" title="(in Python v2.7)"><em>string</em></a>) &#8211; </li>
<li><strong>section</strong> (<a class="reference external" href="http://docs.python.org/library/string.html#string" title="(in Python v2.7)"><em>string</em></a>) &#8211; Path to the configuration file.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A list of <tt class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></tt> pairs for each option in the given section.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">list of tuples</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.core.VT.path">
<tt class="descname">path</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.VT.path" title="Permalink to this definition">¶</a></dt>
<dd><p>Path to the video directory.</p>
</dd></dl>

<dl class="method">
<dt id="VideoTester.core.VT.run">
<tt class="descname">run</tt><big>(</big><big>)</big><a class="headerlink" href="#VideoTester.core.VT.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Do nothing.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method MUST be overwritten by the subclasses.</p>
</div>
</dd></dl>

<dl class="attribute">
<dt id="VideoTester.core.VT.videos">
<tt class="descname">videos</tt><em class="property"> = None</em><a class="headerlink" href="#VideoTester.core.VT.videos" title="Permalink to this definition">¶</a></dt>
<dd><p>List of <tt class="docutils literal"><span class="pre">(id,</span> <span class="pre">name)</span></tt> pairs for each available video.</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/VT200x170.png" alt="Logo"/>
            </a></p>
  <h4>Previous topic</h4>
  <p class="topless"><a href="config.html"
                        title="previous chapter">1. <tt class="docutils literal docutils literal"><span class="pre">VideoTester.config</span></tt> &#8212; Common constants and functions</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="gstreamer.html"
                        title="next chapter">3. <tt class="docutils literal"><span class="pre">VideoTester.gstreamer</span></tt> &#8212; Video processing with GStreamer bindings</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/core.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="gstreamer.html" title="3. VideoTester.gstreamer — Video processing with GStreamer bindings"
             >next</a> |</li>
        <li class="right" >
          <a href="config.html" title="1. VideoTester.config — Common constants and functions"
             >previous</a> |</li>
        <li><a href="index.html">VideoTester 0.2 documentation</a> &raquo;</li>
          <li><a href="modules.html" >Module Reference</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2013, Iñaki Úcar.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>